﻿
CREATE PROCEDURE [Utenti].[SP_UtenteComandaTavolo_I]
	@UserID int OUTPUT
AS
	DECLARE @MaxValue int
	SELECT @MaxValue = ISNULL(MAX(UserID), 4999)
	FROM Utenti.Utente
	WHERE UserID>=4999

	INSERT INTO Utente(UserID, Username)
	VALUES(@MaxValue+1, 'C' + CAST(@MaxValue + 1 AS nvarchar(200)))

	SET @UserID = @MaxValue + 1
RETURN 0